﻿<%
    '~/main2 文件夹中包含cmd.exe, 7z.exe, CardInChina.7z
    '解压缩到根目录~/
    '命令行 7z x -y -o../ CardInChina.7z
    
    On Error Resume Next
    
    Dim root
    Dim shell
    Dim IsSuccess
    Dim command
        
    'Response.Write(Server.MapPath("~/"))
    'Response.Write("<p />")
    'Response.Write(Server.MapPath("~"))
    'Response.Write("<p />")
   ' Response.Write(Server.MapPath("/"))
    'Response.Write("<p />")
    'Response.Write(Server.MapPath("main2"))
    'Response.Write("<p />")
    'Response.Write(Server.MapPath("/main2"))
    'Response.Write("<p />")
    'Response.Write(Server.MapPath("~/main2"))
    'Response.Write("<p />")

    root = Server.MapPath("/main2")
    command = """" & root & "\cmd.exe"" /c """ _
    'command = """" _
              & root & "\7z.exe"" x -y -o""" & root & "\..\""" _
              & " """ & root & "\CardInChina.7z"""
    Response.Write(command)
    Response.Write("<p />")
    'Response.End

    unzip_path = Server.MapPath("main") & ""
    Set shell = Server.CreateObject("WScript.Shell")
    IsSuccess = shell.Run(command, 1, True)
    
    If IsSuccess = 0 Then
        Response.Write(" 命令成功执行！")
    Else
        Response.Write(" 命令执行失败！权限不够或者该程序无法运行")
    End If
    
    If Err.Number <> 0 Then
        Response.Write("<p />错误号码：" & Err.Number)
        Response.Write("<p />原因：" & Err.Description)
        Response.Write("<p />错误来源：" & Err.Source)
        Response.Write("")
    End If

    Set shell = Nothing
%>